home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 18 / CU Amiga Magazine's Super CD-ROM 18 (1997)(EMAP Images)(GB)[!][issue 1998-01].iso / CUCD / Online / hsc / source / ugly / args_fre.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-02  |  2.6 KB  |  111 lines

  1. /*
  2.  * This source code is part of hsc, a html-preprocessor,
  3.  * Copyright (C) 1993-1997  Thomas Aglassinger
  4.  *
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 2 of the License, or
  8.  * (at your option) any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  *
  19.  */
  20. /*
  21.  * ugly/args_fre.c
  22.  *
  23.  * ugly argument freeing functions
  24.  * sub-module for ugly/args.c
  25.  *
  26.  * Copyright (C) 1994,95,96  Thomas Aglassinger
  27.  *
  28.  * This program is free software; you can redistribute it and/or modify
  29.  * it under the terms of the GNU General Public License as published by
  30.  * the Free Software Foundation; either version 2 of the License, or
  31.  * (at your option) any later version.
  32.  *
  33.  * This program is distributed in the hope that it will be useful,
  34.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  35.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  36.  * GNU General Public License for more details.
  37.  *
  38.  * You should have received a copy of the GNU General Public License
  39.  * along with this program; if not, write to the Free Software
  40.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  41.  *
  42.  * updated: 15-Nov-1996
  43.  * created:  3-Jul-1994
  44.  *
  45.  */
  46.  
  47. /*
  48.  * includes
  49.  */
  50. #include <stdio.h>
  51. #include <stdlib.h>
  52. #include <stdarg.h>
  53. #include <string.h>
  54. #include <ctype.h>
  55.  
  56. #include "utypes.h"
  57. #include "umemory.h"
  58. #include "ustring.h"
  59. #include "dllist.h"
  60.  
  61. #include "uargs.h"
  62.  
  63. /*
  64.  * del_arginfo
  65.  *   ( called by _free_args() )
  66.  *
  67.  */
  68. void del_arginfo(APTR data)
  69. {
  70.  
  71.     struct arginfo *arg = (struct arginfo *) data;
  72.  
  73.     if (arg)
  74.     {
  75.  
  76.         /* type dependent cleanup */
  77.         if (arg->ai_type == ARG_ENUM)
  78.             ufreestr(arg->ai_misc1.ai_enum);
  79.  
  80.         /* cleanup entities */
  81.         ufreestr(arg->ai_id);
  82.         ufreestr(arg->ai_help);
  83.         arg->ai_type = 0;
  84.         arg->ai_dest = NULL;
  85.         arg->ai_func = NULL;
  86.  
  87.         /* cleanup whole structure */
  88.         ufree(arg);
  89.  
  90.     }
  91.  
  92. }
  93.  
  94. /*
  95.  * free_args
  96.  *
  97.  * free all memory allocated by _prepare_args()
  98.  *
  99.  * MUST be called after _set_args()
  100.  *
  101.  */
  102. void free_args(struct arglist *al)
  103. {
  104.     if (al)
  105.     {
  106.         del_dllist(al->al_list);
  107.         ufree(al);
  108.     }
  109. }
  110.  
  111.